<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function fn1() {
            return new Promise(resolve => {
                setTimeout(() => {
                    console.log("第一步");
                    // 告诉外界异步已经执行完成
                    resolve();
                }, 1000);
            })
        }

        function fn2() {
            return new Promise(resolve => {
                setTimeout(() => {
                    console.log("第二步");
                    // 告诉外界异步已经执行完成
                    resolve();
                }, 1000);
            })
        }

        fn1().then(res => {
            return fn2();
        }).then(res => {
            setTimeout(() => {
                console.log("完成");
            }, 1000)
        })
    </script>
</body>
</html>